{% extends 'IMTUserBundle::layout-profile.html.twig' %}

{% block main_title %}Profil - Gérer mes comptes{% endblock %}

{% block include_style %}
<link rel="stylesheet" href="{{ asset('custom-plugins/contactlist/contactlist.css') }}" media="screen" />
<style>
.contact-contents {max-height:600px;}
.contact-contents .contact-nav {background-color:#CCCCCC;}
</style>
{% endblock %}

{% block include_script %}
<script src="{{ asset('custom-plugins/contactlist/contactlist.min.js') }}"></script>
<script>
$(document).ready(function(){
	$( '#account_list_contacts' ).contactList();
});
</script>
{% endblock %}

{% block profil_ariane %}
<li>
	<i class="icon-home"></i><a href="{{ path('fos_user_profile_show') }}">Profil</a>
	<span class="divider">&raquo;</span>
</li>
<li>
	<i class="icos-address-book-2"></i><a href="{{ path('account_home') }}">Comptes</a>
	<span class="divider">&raquo;</span>
</li>
<li>
	<i class="icos-book"></i>{{ entity.title }}
</li>
{% endblock %}

{% block profil_header %}
<div class="profile-head clearfix">
	<div class="profile-info pull-left">
		<h1 class="profile-username">Modifier {{ entity.title }} (Gmail)</h1>
	</div>
	
	<div class="btn-toolbar pull-right">
		<a href="#" onclick="$(this).children('form').submit(); return false;" class="btn btn-danger"><i class="icon-remove"></i> Supprimer le compte
	        <form action="{{ path('account_accountgmail_delete', { 'id': entity.id }) }}" method="post" class="hide">
	            {{ form_widget(delete_form) }}
	        </form>
        </a>
	</div>
</div>
{% endblock %}

{% block profil_menu %}
<div class="profile-sidebar">
	<div class="thumbnail">
		<img src="{{ asset('user.png') }}" alt="">
	</div>
	<ul class="nav nav-tabs nav-stacked">
		<li><a href="#"><i class="icos-user"></i> Editer mon profil</a></li>
		<li><a href="#"><i class="icos-cog"></i> Paramétrages</a></li>
		<li><a href="{{ path('account_home') }}"><i class="icos-address-book-2"></i> Gestion des comptes</a></li>
		<li><a href="#"><i class="icos-tag"></i> Gestion des libellés</a></li>
		<li><a href="#"><i class="icos-polaroids"></i> Gestion des plugins</a></li>
	</ul>
</div>
{% endblock %}

{% block profil_content %}
<div class="profile-content">
	<div class="tab-content">
		<div class="tab-pane active" id="profile">
			<div class="row-fluid">
			
				<div class="span6">
					<h4 class="sub"><span>Liste des contacts</span></h4>
					<div class="btn-toolbar">
						<a href="#newContact" data-toggle="modal" class="btn btn-success"><i class="icon-plus"></i> Ajouter un contact</a>
					</div>
					
					<div>
						<ul id="account_list_contacts">
						{% for name, index in contacts %}
					    	<li data-group="{{ name }}">
						        <a class="title">{{ index.title }}</a>
						        {% if index.values|length > 0 %}
						        <ul>
				    			{% for contact in index.values %}
							        <li>
								        <a href="#">
									        <span>{{ contact.firstname }} {{ contact.name }}</span> 
									        <span style="font-size: 11px; display: block;" class="muted">Info fonction + société</span>
										</a>
							        </li>
							    {% endfor %}
						        </ul>
						        {% endif %}
					        </li>
						{% endfor %}
				    	</ul>
			    	</div>
				</div>
				<div class="span6">
					<h4 class="sub"><span>Mon compte</span></h4>
					<div class="widget-content form-container">
                    	<form class="form-horizontal" action="{{ path('account_accountgmail_update', { 'id': entity.id }) }}" method="post" {{ form_enctype(edit_form) }}>
							{{ form_errors(edit_form) }}

							{{ form_row(edit_form.active, {'label':'Activation'}) }}
							{{ form_row(edit_form.title, {'attr': {'class':'span10'}, 'label':'Nom du compte'}) }}               
                            <div class="form-actions">
                            	<div class="hide">{{ form_rest(edit_form) }}</div>
                            	<button class="btn btn-primary" type="submit">Enregistrer les modifications</button>
                        		<button class="btn" type="reset">Rétablir</button>
                        	</div>
                    	</form>
                    </div>
				</div>
				
			</div>										
		</div>
	</div>
</div>

<div class="modal hide fade" id="newContact">
    <div class="modal-header">
        <a class="close" data-dismiss="modal">×</a>
        <h3>Ajout d'un contact</h3>
    </div>
    
    {% render 'IMTUserBundle:Contact:new' with {'idAccount':entity.id} %}
    
</div>

{% endblock %}
